package pl.com.britenet.myredmine.dao.mdb.domain;

import java.io.Serializable;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Domain class for table ANSWER.
 * 
 * @author <a href="mailto:pawel.sprysak@britenet.com.pl">Paweł Sprysak</a>
 * 
 */
@Entity
@Cache(region = "permanent", usage = CacheConcurrencyStrategy.READ_WRITE)
//TODO: Make annotation and LightEntity
//@GenService
@Table(name = "ANSWER")
public class Answer implements Serializable {  //extends LightEntity

    /**
     * Serial number.
     */
    private static final long serialVersionUID = -3721527998906252851L;

    /**
     * Id.
     */
    @Id
    @GeneratedValue(generator = "native")
    @GenericGenerator(name = "native", strategy = "native", parameters = { @Parameter(name = "sequence", value = "SEQ_ANSWER_ID") })
    @Column(name = "ID", nullable = false)
    private Integer id;
      
    /**
     * Issue.
     */
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ISSUE_ID", nullable = false)
    @ForeignKey(name = "FK_ANSWER_ISSUE")
    private Issue issue;
    
    /**
     * Added time.
     */
    @Column(name = "ADD_TIME")
    private Date addTime;
    
    /**
     * User.
     */
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USERS_ID", nullable = false)
    @ForeignKey(name = "FK_ANSWER_USER")
    private Users user;
    
    /**
     * Description.
     */
    @Column(name = "DESCRIPTION")
    private String description;

    /**
     * Setter for property "id".
     * 
     * @param id
     *            Value of property "id".
     */
	public void setId(Integer id) {
		this.id = id;
	}

    /**
     * Getter for property "id".
     * 
     * @return Value of property "id".
     */
	public Integer getId() {
		return id;
	}

    /**
     * Setter for property "issue".
     * 
     * @param issue
     *            Value of property "issue".
     */
	public void setIssue(Issue issue) {
		this.issue = issue;
	}

    /**
     * Getter for property "issue".
     * 
     * @return Value of property "issue".
     */
	public Issue getIssue() {
		return issue;
	}

    /**
     * Setter for property "addTime".
     * 
     * @param addTime
     *            Value of property "addTime".
     */
	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}

    /**
     * Getter for property "addTime".
     * 
     * @return Value of property "addTime".
     */
	public Date getAddTime() {
		return addTime;
	}

    /**
     * Setter for property "user".
     * 
     * @param user
     *            Value of property "user".
     */
	public void setUser(Users user) {
		this.user = user;
	}

    /**
     * Getter for property "user".
     * 
     * @return Value of property "user".
     */
	public Users getUser() {
		return user;
	}

    /**
     * Setter for property "description".
     * 
     * @param description
     *            Value of property "description".
     */
	public void setDescription(String description) {
		this.description = description;
	}

    /**
     * Getter for property "description".
     * 
     * @return Value of property "description".
     */
	public String getDescription() {
		return description;
	}

}
